package com.pucheng.bracelet.app.util

import android.annotation.SuppressLint
import android.text.TextUtils
import java.text.SimpleDateFormat
import java.util.*

object DateFormat {
    fun timeFormat(time: String): String {
        val times = time.split("[:]".toRegex()).toTypedArray()
        return if (times[0].toInt() > 12) {
            "下午 " + (Integer.valueOf(times[0]) - 12) + ":" + times[1]
        } else "上午 $time"
    }

    @SuppressLint("SimpleDateFormat")
    @JvmStatic
    fun m6372a(date: Date?, str: String?): String? {
        return if (date != null || !TextUtils.isEmpty(str)) {
            SimpleDateFormat(str).format(date)
        } else null
    }

}